﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;

namespace WindowsFormsApplication2
{
    public class GanjiHousePub : BoundaryPostData
    {

        public GanjiHousePub(CookieCollection ck)
            : base(ck)
        {

        }


       
      
        /// <summary>
        /// 小区名:水岸枫情
        /// </summary>

        public string xiaoqu { get; set; }


        /// <summary>
        /// 小区拼音:shuianfengqing1
        /// </summary>
        public string xiaoqu_pinyin { get; set; }

        /// <summary>
        /// 所在区:(鄞州)
        /// </summary>
        public string _unused_district_id { get; set; }

        /// <summary>
        /// 所在区:(鄞州)id2054
        /// </summary>
        public string district_id { get; set; }

        /// <summary>
        /// 所在街道:(石碶)
        /// </summary>
        public string _unused_street_id { get; set; }


        /// <summary>
        /// 所在街道:(鄞州石碶)id3612
        /// </summary>
        public string street_id { get; set; }


        /// <summary>
        /// 所在路:联丰薛家南路
        /// </summary>
        public string xiaoqu_address { get; set; }

        /// <summary>
        /// 地图坐标:b121.508273,29.867328
        /// </summary>
        public string latlng { get; set; }

     
        /// <summary>
        /// area:面积
        /// </summary>
        public string area { get; set; }


        /// <summary>
        /// ceng:楼层
        /// </summary>
        public string ceng { get; set; }

        /// <summary>
        /// ceng:总楼层
        /// </summary>
        public string ceng_total { get; set; }

        /// <summary>
        /// _unused_chaoxiang:朝向中文
        /// </summary>
        public string _unused_chaoxiang { get; set; }
        /// <summary>
        /// chaoxiang:朝向2南
        /// </summary>
        public string chaoxiang { get; set; }

        /// <summary>
        /// zhuangxiu:装修中文
        /// </summary>
        public string _unused_zhuangxiu { get; set; }
        /// <summary>
        /// zhuangxiu:装修:2精装修
        /// </summary>
        public string zhuangxiu { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string _unused_fang_xing { get; set; }

        /// <summary>
        /// 房型:3普通住宅
        /// </summary>
        public string fang_xing { get; set; }

        /// <summary>
        /// peizhi:配置字段名peizhi[],值床
        /// </summary>
        public string peizhi { get; set; }

        /// <summary>
        /// price:价格1111
        /// </summary>
        public string price { get; set; }


        public string _unused_pay_type_int { get; set; }
        /// <summary>
        /// pay_type_int:支付方式押一付三1
        /// </summary>
        public string pay_type_int { get; set; }

        /// <summary>
        /// title:标题:
        /// </summary>
        public string title
        {

            get;
            set;
        }
        /// <summary>
        /// description:详情描述
        /// </summary>
        public string description { get; set; }
        /// <summary>
        /// phone:联系电话
        /// </summary>
        public string phone { get; set; }
        /// <summary>
        /// 图片上传:image:
        ////[[{"image":"gjfs15/M01/95/AA/CgEHQVZEH6KNFfQDAAGRCxVLAI0826.jpg","thumb_image":"gjfs15/M01/95/AA/CgEHQVZEH6KNFfQDAAGRCxVLAI0826_90-75c_6-0.jpg","width":600,"height":450,"id":"guid_1_14473054159620_14149492303840816","is_new":true},{"image":"gjfs15/M02/95/B0/CgEHQVZEH6vxmTgvAAGrqqRzqvw950.jpg","thumb_image":"gjfs15/M02/95/B0/CgEHQVZEH6vxmTgvAAGrqqRzqvw950_90-75c_6-0.jpg","width":600,"height":450,"id":"guid_2_14473054240760_4175624707713723","is_new":true}],[]]
        /// </summary>
        public string images
        {

            get;
            set;
        }

      
        public string _unused_bid_structure { get; set; }
        /// <summary>
        ///建筑结构: 高层板楼
        /// </summary>
        public string bid_structure { get; set; }
        /// <summary>
        /// 产权:商品房1
        /// </summary>
        public string _unused_house_property { get; set; }
        public string house_property { get; set; }
        /// <summary>
        /// 产权:70年
        /// </summary>
        public string _unused_land_tenure { get; set; }

        public string land_tenure { get; set; }

        /// <summary>
        /// 年代
        /// </summary>
        public string niandai { get; set; }
        private string _rent_mode;

        /// <summary>
        /// 1整租2合租
        /// </summary>
        public string rent_mode
        {
            get
            {
                if (string.IsNullOrEmpty(_rent_mode))
                {
                    return "1";
                }
                else
                {

                    return _rent_mode;
                }


            }
            set
            {
                _rent_mode = value;
            }
        }
        private string _agent;
        /// <summary>
        /// agent:0个人,1经纪人
        /// </summary>
        public string agent
        {
            get
            {

                if (string.IsNullOrEmpty(_agent))
                {
                    return "0";
                }
                else
                {
                    return _agent;
                }
            }
            set
            {
                _agent = value;
            }
        }
        private string _tab_system;
        /// <summary>
        /// tab_system:系统标签:1
        /// </summary>
        public string tab_system
        {
            get
            {

                if (string.IsNullOrEmpty(_tab_system))
                {
                    return "1";
                }
                else
                {
                    return _tab_system;
                }
            }
            set
            {
                _tab_system = value;
            }
        }
        private string _tab_personality;
        /// <summary>
        /// tab_personality:个人标签:空
        /// </summary>
        public string tab_personality
        {
            get
            {

                if (string.IsNullOrEmpty(_tab_personality))
                {
                    return "";
                }
                else
                {
                    return _tab_personality;
                }
            }
            set
            {
                _tab_personality = value;
            }
        }
        private string _huxing_shi;
        /// <summary>
        /// huxing_shi:户型市
        /// </summary>
        public string huxing_shi
        {
            get
            {

                if (string.IsNullOrEmpty(_huxing_shi))
                {
                    return "1";
                }
                else
                {
                    return _huxing_shi;
                }
            }
            set
            {
                _huxing_shi = value;
            }
        }

        private string _huxing_ting;
        /// <summary>
        /// huxing_ting:
        /// </summary>
        public string huxing_ting
        {
            get
            {

                if (string.IsNullOrEmpty(_huxing_ting))
                {
                    return "2";
                }
                else
                {
                    return _huxing_ting;
                }
            }
            set
            {
                _huxing_ting = value;
            }
        }
        private string _huxing_wei;
        /// <summary>
        /// huxing_wei:卫
        /// </summary>
        public string huxing_wei
        {
            get
            {

                if (string.IsNullOrEmpty(_huxing_wei))
                {
                    return "1";
                }
                else
                {
                    return _huxing_wei;
                }
            }
            set
            {
                _huxing_wei = value;
            }
        }
       
        private string _person;
        /// <summary>
        /// person:联系人:空
        /// </summary>
        public string person
        {
            get
            {

                if (string.IsNullOrEmpty(_person))
                {
                    return "";
                }
                else
                {
                    return _person;
                }
            }
            set
            {
                _person = value;
            }
        }
      


        private string _phone_verify;
        /// <summary>
        /// phone_verify:电话验证:空
        /// </summary>
        public string phone_verify
        {
            get
            {

                if (string.IsNullOrEmpty(_phone_verify))
                {
                    return "";
                }
                else
                {
                    return _phone_verify;
                }
            }
            set
            {
                _phone_verify = value;
            }
        }
        private string _user_word;
        /// <summary>
        /// user_word:验证文字空
        /// </summary>
        public string user_word
        {
            get
            {

                if (string.IsNullOrEmpty(_user_word))
                {
                    return "";
                }
                else
                {
                    return _user_word;
                }
            }
            set
            {
                _user_word = value;
            }
        }
        private string _checkcode;
        /// <summary>
        /// checkcode:验证码
        /// </summary>
        public string checkcode
        {
            get
            {

                if (string.IsNullOrEmpty(_checkcode))
                {
                    return "点击查看验证码";
                }
                else
                {
                    return _checkcode;
                }
            }
            set
            {
                _checkcode = value;
            }
        }
        private string _pinyin;
        /// <summary>
        /// pinyin:验证拼音空
        /// </summary>
        public string pinyin
        {
            get
            {

                if (string.IsNullOrEmpty(_pinyin))
                {
                    return "";
                }
                else
                {
                    return _pinyin;
                }
            }
            set
            {
                _pinyin = value;
            }
        }

        private string _times;
        /// <summary>
        /// times:次数2
        /// </summary>
        public string times
        {
            get
            {

                if (string.IsNullOrEmpty(_times))
                {
                    return "2";
                }
                else
                {
                    return _times;
                }
            }
            set
            {
                _times = value;
            }
        }

        private string _is_edit;
        /// <summary>
        /// is_edit:是否编辑
        /// </summary>
        public string is_edit
        {
            get
            {

                if (string.IsNullOrEmpty(_is_edit))
                {
                    return "0";
                }
                else
                {
                    return _is_edit;
                }
            }
            set
            {
                _is_edit = value;
            }
        }

        private string _elevator;
        /// <summary>
        /// elevator:1有0无
        /// </summary>
        public string elevator
        {
            get
            {
        
        	if (string.IsNullOrEmpty(_elevator))
        	{
        	    return "1";
        	}
        	else
        	{
        	    return _elevator;
        	}
            }
            set
            {
        	_elevator = value;
            }
        }
        
        private string ContentDispositionFormat = "\r\nContent-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n";
        private string boundarySectionSpliter
        {

            get
            {

                ///return "--" + this.TicksStr;
              //  return "-----------------------------" + this.TicksStr;
                return "------WebKitFormBoundary" + this.TicksStr;
            }
        }
        public string GetContentDisposition(string name, string value)
        {
            return boundarySectionSpliter+string.Format(ContentDispositionFormat, name, value).ToString();

        }
        /// <summary>
        /// 出租发布
        /// </summary>
        /// <param name="allowdir"></param>
        /// <param name="urla"></param>
        /// <param name="postdata"></param>
        /// <returns></returns>
        public string doreqoutPub2(bool allowdir, string urla, string postdata)
        {

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urla);

            req.CookieContainer = new CookieContainer();
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0E; .NET4.0C; Tablet PC 2.0; InfoPath.3)";

            //11.11 
            req.CookieContainer.Add(cklist);
            req.Headers.Add("Upgrade-Insecure-Requests", "1");
            req.Referer = "http://www.ganji.com/pub/pub.php?act=pub&method=load&cid=7&mcid=20&domain=nb";
            req.Method = "POST";
            if (this.wp != null)
            {
                req.Proxy = wp;
            }
            req.AllowAutoRedirect = allowdir;

          
            req.Method = "POST";
           
            //  string pt = "multipart/form-data; boundary=---------------------------7dfc8820c4c";
            if (false)
            {
                string responseData = String.Empty;
                var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
                var boundarytx = DateTime.Now.Ticks.ToString("x");
                postdata = Properties.Settings.Default.postnr.ToString();
                string ptmatch = "Content-Disposition: form-data; name=\"([^\"]+)\"\\s*(\\S*)\\s*------";
                MatchCollection match2 = Regex.Matches(postdata, ptmatch);
                string postbody = "\r\n\r\n";
                foreach (Match item in match2)
                {
                    string rich1 = item.Groups[1].Value;
                    string rich2 = item.Groups[2].Value;
                    // richTextBox1.Text += rich1 + "," + rich2 + ",";

                    var vbody = string.Format(@"-----------------------------" + boundarytx + "\r\nContent-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n", rich1, rich2);
                    postbody += vbody;
                }
                postbody += @"-----------------------------" + boundarytx + "--";
            }
            //    Encoding e8859Encode = Encoding.GetEncoding("iso-8859-1");
            //  byte[] bs = Encoding.ASCII.GetBytes(postbody);
            //  postbody = Properties.Settings.Default.posthct;

            StringBuilder sb = new StringBuilder();

            //sb.Append("\r\n\r\n");
            //sb.Append("Referer: " + this.Referer+"\r\n");
            //sb.Append("Content-type:" + "multipart/form-data; boundary=" + this.TicksStr);

            //sb.Append("\r\n\r\n");


            sb.Append(GetContentDisposition("rent_mode", rent_mode));
            sb.Append(GetContentDisposition("agent", agent));
            sb.Append(GetContentDisposition("xiaoqu", xiaoqu));
            sb.Append(GetContentDisposition("xiaoqu_pinyin", xiaoqu_pinyin));
            sb.Append(GetContentDisposition("_unused", _unused_district_id));
            sb.Append(GetContentDisposition("district_id", district_id));

            sb.Append(GetContentDisposition("_unused", _unused_street_id));

            sb.Append(GetContentDisposition("street_id", street_id));
            sb.Append(GetContentDisposition("xiaoqu_address", xiaoqu_address));
            sb.Append(GetContentDisposition("latlng", latlng));
            sb.Append(GetContentDisposition("huxing_shi", huxing_shi));
            sb.Append(GetContentDisposition("huxing_ting", huxing_ting));
            sb.Append(GetContentDisposition("huxing_wei", huxing_wei));

            sb.Append(GetContentDisposition("area", area));
            sb.Append(GetContentDisposition("ceng", ceng));
            sb.Append(GetContentDisposition("ceng_total", ceng_total));
            sb.Append(GetContentDisposition("_unused", _unused_chaoxiang));
            sb.Append(GetContentDisposition("chaoxiang", chaoxiang));
            sb.Append(GetContentDisposition("_unused", _unused_zhuangxiu));
            sb.Append(GetContentDisposition("zhuangxiu", zhuangxiu));

            sb.Append(GetContentDisposition("_unused", _unused_fang_xing));
            sb.Append(GetContentDisposition("fang_xing", fang_xing));
            sb.Append(GetContentDisposition("peizhi[]", peizhi));
            sb.Append(GetContentDisposition("price", price));
            sb.Append(GetContentDisposition("_unused", _unused_pay_type_int));
            sb.Append(GetContentDisposition("pay_type_int", pay_type_int));
            sb.Append(GetContentDisposition("title", title));

            sb.Append(GetContentDisposition("tab_system", tab_system));
            sb.Append(GetContentDisposition("tab_personality", tab_personality));

            sb.Append(GetContentDisposition("description", description));
            sb.Append(GetContentDisposition("images", images));
            sb.Append(GetContentDisposition("person", person));

            sb.Append(GetContentDisposition("phone", phone));
            sb.Append(GetContentDisposition("phone_verify", phone_verify));

            sb.Append(GetContentDisposition("user_word", user_word));



            sb.Append(GetContentDisposition("checkcode", checkcode));
            sb.Append(GetContentDisposition("pinyin", pinyin));

            sb.Append(GetContentDisposition("times", times));

            sb.Append(GetContentDisposition("is_edit", is_edit));
          
            sb.Append(boundarySectionSpliter + "--");

            byte[] bs = Encoding.UTF8.GetBytes(sb.ToString());

            string pt = "multipart/form-data; boundary=----WebKitFormBoundary" + this.TicksStr;
            req.ContentType = pt;
            req.ContentLength = bs.Length;
            req.Accept = "gzip, deflate";
            // req.CookieContainer = new System.Net.CookieContainer();
            //   req.CookieContainer.Add( strCokAddColnew("lg=1; ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; __utma=32156897.89665725.1446446419.1446446419.1446685942.2; __utmz=32156897.1446446419.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); undefined=0b599f13-59bb-4046-a877-352f7c5bc2c5; citydomain=nb; NTKF_T2D_CLIENTID=guest016AF395-C541-D138-A824-C6F7D48CE723; sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; __utmb=32156897.10.10.1446685942; __utmt=1; 58uuid=d60ba0ca-88f0-4122-bbf5-a6cda97fde62; last_name=elingsoft123; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A33801389483%7D; __utmc=32156897; GANJISESSID=ac5c6e3d6fe1e048616e1913f6266fa9",".ganji.com",new CookieCollection()));
            //11.11
            // req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=5170713550418216074941; ganji_xuuid=a00bd1e8-8802-4d0f-8737-20af1e6f4f17; undefined=51fcc4f3-d030-4435-85e1-171248097f40; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; bdshare_firstime=1446620003045; 58uuid=a8a7d56c-88fd-46a0-872a-85a370f9b007; GANJISESSID=826e55f6ec397d421876d60eddeb9b76; sscode=ok%2FU3YcPpemPfJQPokXROutr; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; last_name=elingsoft123; STA_DS=1; nTalk_CACHE_DATA={uid:kf_10111_ISME9754_568760582}; NTKF_T2D_CLIENTID=guestA308F3D1-01E9-9234-6C4A-D489AC18228C; lg=1; citydomain=nb; __utma=32156897.1762231046.1444439497.1447203159.1447212544.14; __utmc=32156897; __utmz=32156897.1447212544.14.8.utmcsr=ganji.com|utmccn=(referral)|utmcmd=referral|utmcct=/vip/my_post_list.php; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A31958504601%7D", ".ganji.com", new CookieCollection()));

            //////////////////////////////////////////////////////////////////////////
            //  req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; citydomain=nb;  sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D;  last_name=elingsoft123", ".ganji.com", new CookieCollection()));
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
                reqStream.Close();
            }

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            using (Stream stream = res.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    string msg = streamReader.ReadToEnd();
                    if (string.IsNullOrEmpty(msg))
                    {
                        this.LastStatus = "发布出租成功";
                        return res.Headers["Location"].ToString();
                    }else
                    {

                        this.LastStatus = "发布出租失败";
                        return res.Headers["Location"].ToString();
                    }
                    int a = res.Cookies.Count;
                    if (a > 0)
                    {


                        cklist.Add(res.Cookies);
                    }
                    //    string lc = res.Headers["Location"].ToString();
                    return msg;
                }
            }

            return "";

        }
        /// <summary>
        /// 出售发布
        /// </summary>
        /// <param name="allowdir"></param>
        /// <param name="urla"></param>
        /// <param name="postdata"></param>
        /// <returns></returns>
        public string doreqoutPub1(bool allowdir, string urla, string postdata)
        {

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urla);

            req.CookieContainer = new CookieContainer();
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0E; .NET4.0C; Tablet PC 2.0; InfoPath.3)";

            //11.11 
            req.CookieContainer.Add(cklist);
            req.Headers.Add("Upgrade-Insecure-Requests", "1");
            req.Referer = "http://www.ganji.com/pub/pub.php?act=pub&method=load&cid=7&mcid=20&domain=nb";
            req.Method = "POST";
            if (this.wp != null)
            {
                req.Proxy = wp;
            }
            req.AllowAutoRedirect = allowdir;


            req.Method = "POST";

            //  string pt = "multipart/form-data; boundary=---------------------------7dfc8820c4c";
            if (false)
            {
                string responseData = String.Empty;
                var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
                var boundarytx = DateTime.Now.Ticks.ToString("x");
                postdata = Properties.Settings.Default.postnr.ToString();
                string ptmatch = "Content-Disposition: form-data; name=\"([^\"]+)\"\\s*(\\S*)\\s*------";
                MatchCollection match2 = Regex.Matches(postdata, ptmatch);
                string postbody = "\r\n\r\n";
                foreach (Match item in match2)
                {
                    string rich1 = item.Groups[1].Value;
                    string rich2 = item.Groups[2].Value;
                    // richTextBox1.Text += rich1 + "," + rich2 + ",";

                    var vbody = string.Format(@"-----------------------------" + boundarytx + "\r\nContent-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n", rich1, rich2);
                    postbody += vbody;
                }
                postbody += @"-----------------------------" + boundarytx + "--";
            }
            //    Encoding e8859Encode = Encoding.GetEncoding("iso-8859-1");
            //  byte[] bs = Encoding.ASCII.GetBytes(postbody);
            //  postbody = Properties.Settings.Default.posthct;

            StringBuilder sb = new StringBuilder();

            //sb.Append("\r\n\r\n");
            //sb.Append("Referer: " + this.Referer+"\r\n");
            //sb.Append("Content-type:" + "multipart/form-data; boundary=" + this.TicksStr);

            //sb.Append("\r\n\r\n");
            sb.Append(GetContentDisposition("xiaoqu", xiaoqu));

            sb.Append(GetContentDisposition("xiaoqu_pinyin", xiaoqu_pinyin));

            sb.Append(GetContentDisposition("_unused", _unused_district_id));
            sb.Append(GetContentDisposition("district_id", district_id));

            sb.Append(GetContentDisposition("_unused", _unused_street_id));

            sb.Append(GetContentDisposition("street_id", street_id));
            sb.Append(GetContentDisposition("xiaoqu_address", xiaoqu_address));
            sb.Append(GetContentDisposition("latlng", latlng));

            sb.Append(GetContentDisposition("huxing_shi", huxing_shi));
            sb.Append(GetContentDisposition("huxing_ting", huxing_ting));
            sb.Append(GetContentDisposition("huxing_wei", huxing_wei));

            sb.Append(GetContentDisposition("area", area));
            sb.Append(GetContentDisposition("ceng", ceng));
            sb.Append(GetContentDisposition("ceng_total", ceng_total));

            sb.Append(GetContentDisposition("elevator", elevator));

            sb.Append(GetContentDisposition("_unused", _unused_chaoxiang));
            sb.Append(GetContentDisposition("chaoxiang", chaoxiang));

            sb.Append(GetContentDisposition("_unused", _unused_zhuangxiu));
            sb.Append(GetContentDisposition("zhuangxiu", zhuangxiu));


            sb.Append(GetContentDisposition("_unused", _unused_bid_structure));
            sb.Append(GetContentDisposition("bid_structure", bid_structure));


            sb.Append(GetContentDisposition("_unused", _unused_fang_xing));
            sb.Append(GetContentDisposition("fang_xing", fang_xing));


            sb.Append(GetContentDisposition("_unused", _unused_house_property));
            sb.Append(GetContentDisposition("house_property", house_property));

            sb.Append(GetContentDisposition("_unused", _unused_land_tenure));
            sb.Append(GetContentDisposition("land_tenure", land_tenure));



            sb.Append(GetContentDisposition("niandai", niandai));
            sb.Append(GetContentDisposition("price", price));

            sb.Append(GetContentDisposition("title", title));
            sb.Append(GetContentDisposition("description", description));
            sb.Append(GetContentDisposition("images", images));
            sb.Append(GetContentDisposition("agent", agent));
            sb.Append(GetContentDisposition("person", person));

            sb.Append(GetContentDisposition("phone", phone));
            sb.Append(GetContentDisposition("checkcode", checkcode));
            sb.Append(GetContentDisposition("pinyin", pinyin));

            sb.Append(GetContentDisposition("times", times));

            sb.Append(GetContentDisposition("is_edit", is_edit));

            //sb.Append(GetContentDisposition("land_tenure", land_tenure));
            //sb.Append(GetContentDisposition("rent_mode", rent_mode));
          
        
           
          
    

        
            //sb.Append(GetContentDisposition("peizhi[]", peizhi));
          
            //sb.Append(GetContentDisposition("_unused", _unused_pay_type_int));
            //sb.Append(GetContentDisposition("pay_type_int", pay_type_int));
          
            //sb.Append(GetContentDisposition("tab_system", tab_system));
            //sb.Append(GetContentDisposition("tab_personality", tab_personality));

           
          
          
            //sb.Append(GetContentDisposition("phone_verify", phone_verify));

            //sb.Append(GetContentDisposition("user_word", user_word));



          

            sb.Append(boundarySectionSpliter + "--");

            byte[] bs = Encoding.UTF8.GetBytes(sb.ToString());

            string pt = "multipart/form-data; boundary=----WebKitFormBoundary" + this.TicksStr;
            req.ContentType = pt;
            req.ContentLength = bs.Length;
            req.Accept = "gzip, deflate";
            // req.CookieContainer = new System.Net.CookieContainer();
            //   req.CookieContainer.Add( strCokAddColnew("lg=1; ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; __utma=32156897.89665725.1446446419.1446446419.1446685942.2; __utmz=32156897.1446446419.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); undefined=0b599f13-59bb-4046-a877-352f7c5bc2c5; citydomain=nb; NTKF_T2D_CLIENTID=guest016AF395-C541-D138-A824-C6F7D48CE723; sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; __utmb=32156897.10.10.1446685942; __utmt=1; 58uuid=d60ba0ca-88f0-4122-bbf5-a6cda97fde62; last_name=elingsoft123; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A33801389483%7D; __utmc=32156897; GANJISESSID=ac5c6e3d6fe1e048616e1913f6266fa9",".ganji.com",new CookieCollection()));
            //11.11
            // req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=5170713550418216074941; ganji_xuuid=a00bd1e8-8802-4d0f-8737-20af1e6f4f17; undefined=51fcc4f3-d030-4435-85e1-171248097f40; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; bdshare_firstime=1446620003045; 58uuid=a8a7d56c-88fd-46a0-872a-85a370f9b007; GANJISESSID=826e55f6ec397d421876d60eddeb9b76; sscode=ok%2FU3YcPpemPfJQPokXROutr; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; last_name=elingsoft123; STA_DS=1; nTalk_CACHE_DATA={uid:kf_10111_ISME9754_568760582}; NTKF_T2D_CLIENTID=guestA308F3D1-01E9-9234-6C4A-D489AC18228C; lg=1; citydomain=nb; __utma=32156897.1762231046.1444439497.1447203159.1447212544.14; __utmc=32156897; __utmz=32156897.1447212544.14.8.utmcsr=ganji.com|utmccn=(referral)|utmcmd=referral|utmcct=/vip/my_post_list.php; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A31958504601%7D", ".ganji.com", new CookieCollection()));

            //////////////////////////////////////////////////////////////////////////
            //  req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; citydomain=nb;  sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D;  last_name=elingsoft123", ".ganji.com", new CookieCollection()));
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
                reqStream.Close();
            }

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            using (Stream stream = res.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    string msg = streamReader.ReadToEnd();
                    if (string.IsNullOrEmpty(msg))
                    {
                        this.LastStatus = "发布出售成功";
                        return res.Headers["Location"].ToString();
                    }
                    else
                    {

                        this.LastStatus = "发布出售失败";
                        return res.Headers["Location"].ToString();
                    }
                    int a = res.Cookies.Count;
                    if (a > 0)
                    {


                        cklist.Add(res.Cookies);
                    }
                    //    string lc = res.Headers["Location"].ToString();
                    return msg;
                }
            }

            return "";

        }
    }
}